#include <eosio/eosio.hpp>

using namespace eosio;
using std::string;

class[[eosio::contract("yktoken")]] yktoken : public contract
{
    public:
        using contract::contract;
        yktoken(name receiver, name code, datastream<const char *> ds) : contract(receiver, code, ds) {}

        // 表的定义
        // 余额表
        struct [[eosio::table]] balance
        {
            name    username; //用户名
            uint64_t  amount;
            auto primary_key() const { return username.value; }
            
            EOSLIB_SERIALIZE( balance, (username)(amount))
        };

        typedef eosio::multi_index<"balances"_n, balance> balances;

        // 发行量&符号表
        struct [[eosio::table]] supply
        {
            name    symbol; //积分符号
            uint64_t  totalSupply;
            auto primary_key() const { return symbol.value; }
            
            EOSLIB_SERIALIZE( supply, (symbol)(totalSupply))
        };

        typedef eosio::multi_index<"supplys"_n, supply> supplys;
        // 定义动作 
        [[eosio::action]]
        void ykcreate(name admin, name symbol);
        [[eosio::action]]
        void ykissue(name admin, name symbol, uint64_t supply);
        [[eosio::action]]
        void yktransfer(name admin, name symbol, name from, name to, uint64_t amount);
        [[eosio::action]]
        uint64_t ykbalanceof(name admin, name symbol, name who);
        [[eosio::action]]
        uint64_t yksupply(name admin, name symbol);

    private:

};
